﻿using System;
using System.IO;
using FunctionalCLR.Core;

namespace FunctionalCLR.Shell.Function.IO {

    /// <summary>
    /// hasfile("c:\\hello.txt");
    /// </summary>
    public class FileExistNode : FuncNode {

        public FileExistNode()
            : base() {
            base.Value = "hasFile";
        }

        public override FuncNode GetReversedFunction(int index) {
            throw new NotImplementedException();
        }

        public override object Evaluate() {
            return File.Exists(Children[0].Evaluate().ToString());
        }
    }
}
